<?php 
/** 
 * Hello Model for Hello World Component 
 *  
 * @package    Joomla.Tutorials 
 * @subpackage Components 
 *         @link         http://dev.joomla.org/component/option,com_jd-
wiki/Itemid,31/id,tutorials:modules/ 
 * @license    GNU/GPL 
 */ 
// Check to ensure this file is included in Joomla! 
defined('_JEXEC') or die(); 
jimport( 'joomla.application.component.model' ); 
/** 
 * Hello Model 
 *  * 
 * @package    Joomla.Tutorials 
 * @subpackage Components 
 */ 
class HelloModelHello extends JModel 
{ 
    /** 
    * Gets the greeting 
    * @return string The greeting to be displayed to the user 
    */ 
    function getGreeting() 
    { 
    	 $db =& JFactory::getDBO();
    	 $query = 'SELECT greeting FROM #__hello';
    	 $db->setQuery( $query ); 
    	 $greeting = $db->loadResult();   
      return $greeting; 
    } 
} 